﻿<%@ Page Language="C#" Title="事故数据监测" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="S_RdcarPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Survey.S_RdcarPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>
    
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/dropdown.js")%>    
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Enum.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Bussiness.js")%>

    <script type="text/javascript">      

        function S_RdcarEdit(flag)
        {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '编辑数据时，请选择一项!', 'warning');
                return;
            }


            $('#fm').form('clear');
            $('#fm').form('load', row);
            $('#dlg').dialog('open');
        }

        function S_RdcarDel() {
            var row = $('#dg').datagrid('getSelected');
            if (!row) {
                $.messager.alert('消息提示', '删除数据时，请选择一项!', 'warning');
                return;
            }

            deleteData($('#dg'), $('#dlg'), "/api/rdcar");
        }



        function search(n, o) {
            var road = $('#cmbRoads').combobox("getValue");
            var checkDate = $('#checkDate').datebox('getValue');  //注意.datebox('getValue')

            var url = '/api/rdcar';
            var urlParam = "";
            if (road != "" && road != "0") urlParam += "road=" + encodeURI(road) + "&";
            if (checkDate != "") urlParam += "checkDate=" + encodeURI(checkDate) + "&";
            if (urlParam != "") {
                urlParam = "?" + urlParam.substring(0, urlParam.length - 1);
                url = url + urlParam;
            }

            $('#dg').datagrid({ url: url, pageNumber: 1 });
        }
       

        $(function () {
            var number= '<%= Page.RouteData.Values["page"] %>';
            var size = '<%= Page.RouteData.Values["size"] %>';

            dataGridBind($('#dg'), '/api/rdcar', '事故数据列表显示', $('#tb'), number, size);

            $('.validatebox-text').bind('blur', function () {
                $(this).validatebox('enableValidation').validatebox('validate');
            });
        })

        
    </script>    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table id="dg" class="easyui-datagrid content-place"  ajaxCached="false"  >
        <thead>
            <tr>
                <th data-options="field:'Rdcarid',editor:'text',width:120,align:'center' ,hidden:true">事故ID</th>
                <th data-options="field:'Rdwayid',editor:'text',width:80,align:'center' ">路线编号</th>
                <th data-options="field:'Direction_Dictid',editor:'numberbox',width:80,align:'center'" formatter="formatDirection">行车方向</th>
                <th data-options="field:'His_Version',editor:'numberbox',width:80,align:'center' ,hidden:true">养护版本</th>
                <th data-options="field:'Carmp',editor:'numberbox',width:80,align:'right' " formatter="formatPile">事故点桩号</th>
                <th data-options="field:'Cardate',editor:'datebox',width:120,align:'right' " formatter="formatDate">发生时间</th>
                <th data-options="field:'Carloc',editor:'text',width:120,align:'right' ">事故点</th>
                <th data-options="field:'Surveyer',editor:'text',width:80,align:'right' ">记录人员</th>
                <th data-options="field:'Adtgd_Dictid',editor:'numberbox',width:120,align:'right' " formatter="formatAccidentTyp">事故类别</th>
                <th data-options="field:'Accreason_Dictid',editor:'numberbox',width:120,align:'right'" formatter="formatAccidentTyp">事故原因</th>
                <th data-options="field:'Accdesc',editor:'text',width:200,align:'right' ">事故描述</th>
            </tr>
        </thead>
    </table>
   
    <!--测试数据命令-->
    <div id="tb">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" onclick="S_RdcarEdit(-1)">编辑</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" onclick="S_RdcarDel()">删除</a>
        <select id="cmbRoads" class="easyui-combobox" panelHeight="80" style="width:100px" data-options="prompt:'路线编号',url:'/api/roadway/dict',method:'get',valueField:'id',textField:'id',onChange:search">
        </select>
	    <input id="checkDate" class="easyui-datebox"  data-options="prompt:'观测日期',onChange:search"/>
    </div>

    <!--测试详细页面-->
    <div id="dlg" class="easyui-dialog" title="保存数据" style="width:500px;height:380px;padding:10px" closed="true"  data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttons'
			">
        <form id="fm" method="post" action="/api/rdcar">
            <table>		                
                <tr  style="display:none">
                    <td>事故ID:</td>     
                    <td><input name='Rdcarid'  class="easyui-textbox" data-options="required:true,readonly:true"/></td>   
                </tr>    
                <tr>
                   <td>路线编号:</td>
                    <td><input name='Rdwayid'  class=" easyui-combobox" data-options="required:true,readonly:true,valueField:'Rdwayid',textField:'Name',panelHeight:'auto',url:'/api/roadway/all',method:'get'"/></td>
                </tr>	
                 <tr>
                    <td>行车方向:</td>
                     <td><input  name='Direction_Dictid' class=' easyui-combobox'  data-options="required:true,readonly:true,valueField:'id',textField:'text',panelHeight:'auto',url:'/api/data/direction',method:'get'" /></td>
                </tr>                  
                 <tr style="display:none">
                    <td>养护版本:</td>
                    <td><input name='His_Version' class='easyui-numberbox' data-options="required:true,readonly:true"/></td>
                </tr> 
                <tr>
                    <td>事故点桩号:</td>
                    <td><input name='Carmp' class='easyui-validatebox easyui-numberbox'  data-options='required:true,min:0,precision:2,formatter:formatPile' /></td>
                </tr>                  	     
                <tr>
                    <td>发生时间:</td>
                    <td><input name='Cardate' class='easyui-validatebox easyui-datebox'   data-options="required:true"/></td>
                </tr>
                <tr>
                    <td>事故点:</td>
                    <td><input name='Carloc' class='easyui-validatebox easyui-textbox'  data-options="validType:'MaxLength[250]'"/></td>
                </tr>
                <tr>
                    <td>记录人员:</td>
                    <td><input name='Surveyer' class='easyui-validatebox easyui-textbox' data-options="validType:'MaxLength[50]'" /></td>
                </tr>
                <tr>
                    <td>事故等级:</td>
                    <td><input name='Adtgd_Dictid'  class="easyui-validatebox  easyui-combobox" data-options="prompt:'事故等级',valueField:'id',textField:'text',url:'/api/data/acctype',method:'get' "/></td>
                </tr>
                <tr>
                    <td>事故原因:</td>
                    <td><input name='Accreason_Dictid'  class="easyui-validatebox  easyui-combobox" data-options="prompt:'事故原因',valueField:'id',textField:'text',url:'/api/data/accreason',method:'get' "/></td>
                </tr>
                 <tr>
                    <td>事故描述:</td>
                    <td><input name='Accdesc' class='easyui-validatebox easyui-textbox'  data-options="validType:'MaxLength[250]',multiline:true" style="width:350px;height:100px"/></td>
                </tr>
		    </table>
        </form>
    </div>

    <!--编辑数据命令-->
    <div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:sumbitData($('#dg'),$('#dlg'))">保存</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#dlg').dialog('close')">取消</a>
	</div>
</asp:Content>
